-0b33f7139b9f }';Type
//************************************** *******************************//// Forward Declaration of types defined in typelibrary//************************************** *******************************//Itest = interface;Itestdisp = dispinterface;
//************************************** *******************************//// Declaration of coclasses defined in Type Library// (Note: here we map each coclass to its default Interface)//************************************** **
myobj. If you do not know how to perform this operation, see the relevant sections of the Delphi reference book. Press F12 to view the generated myobj_tlb.pas file. The iupfile interface should look like this:
iupfile = interface (idispatch) ['{response}'] procedure onstartpage (const ascriptingcontext: iunknown); safecall; procedure onendpage; safecall; function get_form (formname: olevariant): olev
be more familiar.Under MyObj, under the interface named Iupfile, add 5 properties and one method. If you do not know how to operate, see the relevant parts of Delphi reference books. Press F12 to see the corresponding Myobj_tlb.pas file generated, where the Iupfile interface should look like this:Iupfile = Interface (IDispatch)[' {5c40d0eb-5a22-4a1e-8808-62207ae04b51} ']Procedure OnStartPage (const ascriptingcontext:iunknown); Safecall;Procedure OnEn
-1d80e748b67f} ']Procedure Speakto (const content:widestring; destid:integer); Safecall;The client speaks to the appointed room, DestID the room number.function Readfrom (Sourceid:integer): istrings; Safecall;The client reads the conversation from the specified room, SourceID the room number.function Readready (Id:integer): Byte; Safecall;Customer detects if the
can be easily invoked by users who are familiar with VBScript or JavaScript scripting languages as long as the client's COM component is developed)?
Third, realize
First, run Delphi 5.0; Select New in the File menu, select the ActiveX page in the pop-up dialog box, and select ActiveX Library to create the ActiveX libraries. Then add a Automation object to the new library. Procedure above. Fill in the component name Prttest3 in the Automation Object Wizard dialog box, click OK.
Then, in the p
release the code in the process. Because the execution efficiency in the process is higher than that outside the process. (That is, first create an interface in the process, and then change it to release in the process .)
The COM object is created in the server's process space. If it is an EXE-type server, the server and the client are not in the same process; if it is a DLL-type server, the server and the client are a process. Therefore, memory space can be saved in the process and the instanc
different from the system DLL.Parameters are used in different stack-to-stack modes. For more details, see the following.---------------------When you declare a procedure or function, you can specify a calling convention using one of the Directives register, Pascal, cdecl, stdcall, and safecall. for example, function myfunction (X, Y: Real): real; cdecl ;... Calling conventions determine the order in which parameters are passed to the routine. they a
tapplication and tform types, you need to convert it into integer during input. There are so many things to pay attention to. Let's take a look at the example below (assuming you have already created a project ):
Tcomdlltest1
=
Class
(Tautoobject, icomdlltest1)PrivateFmsgstr widestring;Function getmdiform (AForm tform) Boolean;
Protected
{Protected Declarations}
Function get_msgstr widestring; safecall;Procedure set_msgstr (
C
C # Multi-threading, thread-and-thread-safe examples (three different methods)
The code is as follows
Copy Code
Using System.Threading;public static Class Extensions{Control extension methods (for cross threading operations) because it prevents a deadlock or inconsistent state of resource contention for thread security. NET is not allowed to access a form control across threads.public static void Safecall (this control CTR
COM interface unit and define the interface function. Pay attention to widestring for the return type.
Unit compress;{$ Warn symbol_platform off}InterfaceUsesComobj, ActiveX, zlibcompress_tlb, stdvcl;TypeTzlibcompress = Class (tautoobject, izlibcompress)ProtectedFunction compressdata (const sdata: widestring): widestring; safecall;Function uncompressdata (const sdata: widestring): widestring; safecall;Fun
write down a Safecall method in the extension method class in your project:usingSystem;usingSystem.Windows.Forms;namespacewindowsformsapplication1{ Public Static classExtensions { Public Static voidSafecall ( ThisControl CTRL, Action callback) { if(CTRL. invokerequired) Ctrl. Invoke (callback); Elsecallback (); }} It just takes the code you want to protect as a callback. Then any place that needs to protect some code can be calle
A client sends a paper to the server socket, however, the server limits the frequency of transmission, if only 1 times within 10 seconds, then the client should also be the corresponding restrictions, the initial idea is to save the last time in the configuration file sent, the current delivery and this last time to compare, Send or hibernate the appropriate time according to the situation.
For example, the server sends a frequency limit of 10 seconds, last time is 10:00:00, there are two situat
declaration in the type library:Property Browselect:wordbool read Get_browselect write set_browselect;This shows: For Browselect This property, there is a read method Get_browselect, a write method Set_browselect. Delphi automatically adds a declaration and implementation of a read and write access method to the Browselect property in the control's implementation file:function Get_browselect:wordbool; Safecall;Procedure Set_browselect (Value:wordbool
, aliname:widestring): olevariant;
Safecall;
function execute (const SQLSTR, connstr:widestring): olevariant;
Safecall;
{Protected declarations}
End
Implementation
Uses Comserv;
function Tbdeasp.open (const SQLSTR, aliname:widestring): olevariant;
Var
Tmpre:variant;
Begin
Tmpre:=createoleobject (' Adodb.recordset ');
Try
Tmpre.open (Sqlstr,aliname);
Except
End
Result:=tmpre;
End
function Tbdeasp.exec
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.